#ifndef _PARTHUS_UT_ATS_GENERIC_H
#define _PARTHUS_UT_ATS_GENERIC_H
/*************************************************************************
 * MODULE NAME:    ut_ats_generic.h
 * PROJECT CODE:    BlueStream
 * DESCRIPTION:    Abstract test suite generic methods and structures
 * MAINTAINER:     John Nelson
 * DATE:           1 Feb 2001
 *
 * SOURCE CONTROL: $Id: ut_ats_generic.h,v 1.1 2008/02/03 09:39:25 james Exp $
 *
 * LICENSE:
 *     This source code is copyright (c) 2001-2004 Ceva Inc.
 *     All rights reserved.
 *
 * REVISION HISTORY:
 *    V1.0     01 Feb  2001 -   jn     - Initial Version based on test_harness.c
 *
 * SOURCE:
 *           Derived based on requirements for off board execution to
 *           prove basic compliance of the stack to the
 *           Abstract Test Suites TP V0.9
 * ISSUES:
 *
 *************************************************************************/
/*
 * Enumerators to support tests.
 */
typedef enum e_test_command {
    LMP_SEND, LMP_VERIFY, L2CAP_SEND, L2CAP_VERIFY } t_test_command;

/*
 * Test structure definitions for ats procedures tests
 */
typedef enum e_device_role {
    IUT_AS_CALL = 0,                    /* Legacy for test selection       */
    IUT_SLAVE, 
    IUT_MASTER, 
    IUT_BOTH,
    IUT,                 
    TESTER_SLAVE,
    TESTER_MASTER,
    TESTER_BOTH,
    TESTER
} t_device_role;

typedef struct s_tp_struct {

    char *name;
    char *descr;
    t_error (*function)(void);          /* Pointer to test function         */

    /*
     * Flags for pre/post test functionality where True:
     */
    boolean separate_connection;        /* Setup/Release connection for test*/
    boolean scheduler_active;           /* Execute HC scheduler per slot    */
    boolean log_results_always;         /* Always log results               */

    boolean dont_setup_connection;      /* Don't setup connection for test  */

    t_device_role iut_role;

    t_error execute_status;             /* Final result stored here         */   
} t_ats_test_procedure;

/*
 *  UTgen_Initialise_Local_Device
 *  Generic initialisation of the local device to predefined BD_ADDR
 */
void UTgen_Initialise_Local_Device(void);

/*
 * Useful accessors for tester bd addr and features
 */
void UTgen_Set_Bd_Addr(const t_bd_addr *p_bd_addr_tester);
const t_bd_addr* UTgen_Get_Tester_Bd_Addr_Ref(void);
const u_int8 *UTgen_Get_Tester_Bd_Addr_Byte_Array_Ref(void);
/*
 * Select alternative testers if they exist by connection handle
 */
const t_bd_addr* UTgen_Select_Active_Tester(t_connectionHandle handle);
void UTgen_Select_Default_Tester(void);

const u_int8 *UTgen_Get_Tester_Features_Ref(void);
void UTgen_Set_Tester_Features(const u_int8 features[8]);
boolean UTgen_Is_Tester_Feature_Supported(u_int32 feature_id);
void UTgen_Enable_Feature(u_int32 lmp_feature_id);
void UTgen_Disable_Feature(u_int32 lmp_feature_id);


u_int8 UTgen_Get_Tester_Role(void);
u_int8 UTgen_Get_IUT_Device_Role(void);
void UTgen_Set_IUT_Device_Role(u_int8 new_role);

/*
 * Enable access to the LC device link (where absolutely necessary!)
 */
t_deviceIndex UTgen_Get_Tester_LC_Device_Index(void);

/*
 * UTgen_Execute_Test_Procedure      Execute the Selected Test Procedures
 *
 * p_test_entry         pointer to the t_ats_test_procedure set of test procs
 * num_test_entries     number of test procedures
 * iut_local_role       the role of the iut in the procedures
 */
boolean UTgen_Execute_Test_Procedures(
   t_ats_test_procedure *p_test_entry, u_int32 num_test_entries,
   u_int8 iut_local_role, t_clock native_clk, t_clock s_clk_offset__m_clk);

/*
 *  UTgen_Force_Test_Status to force error status any time during test
 */
void UTgen_Force_Test_Status(t_error status);
t_error UTgen_Get_Test_Status(void);
/*
 *  UTgen_Report_Execution_Comment to record string to report after test
 */
void UTgen_Report_Execution_Comment(const char *comment);

char *UTgen_Get_Test_Result_String(t_error test_result_status);
void UTgen_Initialise_Test_Statistics(void);
void UTgen_Display_Test_Statistics(void);
u_int32 UTgen_Display_Tests_By_Class(u_int8 test_class);

void UTgen_Verify_Core_Host_Controller_Ok(void);

u_int16 UTgen_Get_Number_Tests_Passed(void);
u_int16 UTgen_Get_Number_Tests_Failed(void);
u_int16 UTgen_Get_Number_Tests_Skipped(void);

boolean UTgen_Is_LM_Air_Mode_Supported(u_int8 lm_air_mode);

/*
 * Maximum number expected of ATS tests
 */
#define MAX_NUM_ATS_TESTS   2048

#endif

